package com.zxc.gulimall.ware.dao;

import com.zxc.gulimall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 * 
 * @author zxc
 * @email 2898743173@qq.com
 * @date 2021-10-27 11:30:02
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void addSkuStock(@Param("wareId") Long wareId, @Param("skuId") Long skuId, @Param("stock") Integer stock);

    Long getSkuStock(Long sku);

    List<Long> listWareIdHasSkuStock(Long skuId);

    Long lockSkuStock(Long skuId, Long wareId, Integer num);

    void unLockStock(Long skuId, Long wareId, Integer num);
}
